package net.ibizsys.eclipse.studio.project;

import java.util.List;

import net.ibizsys.eclipse.studio.Activator;
import net.ibizsys.eclipse.studio.console.Console;
import net.ibizsys.eclipse.studio.data.Project;

/**
 * 构建对象
 * 
 * @author <a href='http://www.weibo.com/xjtoo' target='_blank'>Enmaai</a>
 */
public class AppBuilder
{
	private static IBuilder mavenBatchBuilder;

	public static void build() throws Exception
	{
		IBuilder mavenBatchBuilder = new MavenBatchBuilder();
		if (mavenBatchBuilder.init())
		{
			AppBuilder.mavenBatchBuilder = mavenBatchBuilder;
		}
	}

	/**
	 * 构建批处理文件
	 * 
	 * @param buildType
	 * @param project
	 * @param dependProjects
	 * @return
	 */
	public static boolean buildBatch(Project project, List<Project> dependProjects)
	{
		if (mavenBatchBuilder == null)
		{
			Console.println("无法获取批处理构建器.");
			return false;
		}

		return mavenBatchBuilder.build(project, dependProjects, Activator.getDefault().getRootPath());
	}
}
